<?php

namespace App\Filter;

use EloquentFilter\ModelFilter;

class BpmArchivedDataFilter extends ModelFilter
{
    /**
     * Related Models that have ModelFilters as well as the method on the ModelFilter
     * As [relationMethod => [input_key1, input_key2]].
     *
     * @var array
     */
    public $relations = [];

    public function search(string $value)
    {
        return $this->where(function ($query) use ($value){
            return $query->where('Subject','like','%'.$value.'%')
                ->orWhere('WF_ProcessName','like','%'.$value.'%');
        });
    }

    public function date($value)
    {
        return $this->whereDate('WF_DocCreated','=',$value);
    }
}
